package com.stydy.cglib;

import net.sf.cglib.proxy.MethodInterceptor;
import net.sf.cglib.proxy.MethodProxy;

import java.lang.reflect.Method;

/**
 * 黑客类继承方法拦截器，用来扩展程序猿类的业务
 * Created by hhy on 2016/4/28.
 */
public class Hacker implements MethodInterceptor {
    @Override
    public Object intercept(Object o, Method method, Object[] objects, MethodProxy methodProxy) throws Throwable {
        System.out.println("我是叼炸天的黑客，让我们看看苦逼程序猿在干什么...");
        Object object = methodProxy.invokeSuper(o,objects);
        System.out.println("天呢，程序猿太苦逼了...");
        return object;
    }
}
